//
//  TagCollectionViewCell.m
//  UGoods
//
//  Created by dllo on 16/1/28.
//  Copyright © 2016年 蓝鸥科技.李贺. All rights reserved.
//

#import "TagCollectionViewCell.h"
#import "ConstantsDefine.h"

@implementation TagCollectionViewCell

- (void)dealloc
{
    [_tagLabel release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.tagLabel = [[UILabel alloc] init];
        _tagLabel.layer.cornerRadius = 5;
        _tagLabel.layer.masksToBounds = YES;
        _tagLabel.font = [UIFont systemFontOfSize:15 * WIDTH];
        _tagLabel.backgroundColor = [UIColor whiteColor];
        _tagLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_tagLabel];
        [_tagLabel release];
    }
    return self;
}

// 计算buyerBriefLabel宽度
+ (CGFloat)widthWithText:(NSString *)text {
    
    CGRect rect = [text boundingRectWithSize:CGSizeMake(1000 * WIDTH, 20 * HEIGHT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:15 * WIDTH]} context:nil];
    
    return rect.size.width;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    [super applyLayoutAttributes:layoutAttributes];
    _tagLabel.frame = self.contentView.bounds;
}



@end
